package com.xbongbong.admin.domain.entity;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.saas.constant.BasicConstant;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 镜像阶段流程表
 * 
 * @author mingliang.cao
 * 
 * @date 2021-11-16
 */
@Getter
@Setter
public class MirrorStageProcessEntity implements Serializable {
    private static final long serialVersionUID = 2170460478387981411L;
    private Long id;

    /**
     * 镜像表id
     */
    private Long mirrorId;

    /**
     * 镜像表单id
     */
    private Long mirrorFormId;

    /**
     * 原表单Id
     */
    private Long sourceFormId;

    /**
     * 原阶段流程Id
     */
    private Long sourceStageProcessId;

    /**
     * 镜像表单saas标识
     */
    @Deprecated
    private Integer mirrorSaasMark;

    /**
     * 镜像表单businessType
     */
    @Deprecated
    private Integer mirrorBusinessType;

    /**
     * 阶段流程名称
     */
    private String name;

    /**
     * 阶段流程版本名称
     */
    private String versionName;

    /**
     * 阶段流程版本
     */
    private Integer versionId;

    /**
     * 阶段流程是否启用（0不启用、1启用）
     */
    private Integer enable;

    /**
     * 阶段停留单位【1时、2天、3周、4月】
     */
    private Integer stageUnit;

    /**
     * 允许回退阶段（0不允许、1允许）
     */
    private Integer allowBack;

    /**
     * 允许新建选择阶段（0不允许、1允许）
     */
    private Integer allowNewSelect;

    /**
     * 哪些人允许新建选择阶段，空值代表所有人都允许
     */
    private JSONArray allowNewSelectUser;

    /**
     * 阶段用时（0不显示、1显示）
     */
    private Integer showTimeUse;

    /**
     * 阶段停留时长（0不显示、1显示）
     */
    private Integer showTimeStay;

    /**
     * 任务完成情况（0不显示、1显示）
     */
    private Integer showWorkCompletion;

    /**
     * 公司平均完成时长（0不显示、1显示）
     */
    private Integer showAverageCompletionTime;

    /**
     * 触发条件
     */
    private JSONArray triggerCondition;

    /**
     * 1：归档、2：未归档
     */
    private Integer isArchive;

    /**
     * 创建者id
     */
    private String creatorId;

    /**
     * 是否历史数据迁移过来时最早默认生成的流程版本
     */
    private Integer oldTransferVersion;

    /**
     * 创建时间
     */
    private Long addTime;

    /**
     * 更新时间
     */
    private Long updateTime;

    /**
     * 删除标记
     */
    private Integer del;

    public MirrorStageProcessEntity() {
        del = 0;
    }

    public MirrorStageProcessEntity(Long mirrorId, Long mirrorFormId, Long sourceFormId, Long sourceStageProcessId, String name, String versionName, Integer versionId, Integer enable, Integer stageUnit, Integer allowBack, Integer allowNewSelect, JSONArray allowNewSelectUser, Integer showTimeUse, Integer showTimeStay, Integer showWorkCompletion, Integer showAverageCompletionTime, JSONArray triggerCondition, Integer isArchive) {
        this.mirrorId = mirrorId;
        this.mirrorFormId = mirrorFormId;
        this.sourceFormId = sourceFormId;
        this.sourceStageProcessId = sourceStageProcessId;
        this.name = name;
        this.versionName = versionName;
        this.versionId = versionId;
        this.enable = enable;
        this.stageUnit = stageUnit;
        this.allowBack = allowBack;
        this.allowNewSelect = allowNewSelect;
        this.allowNewSelectUser = allowNewSelectUser;
        this.showTimeUse = showTimeUse;
        this.showTimeStay = showTimeStay;
        this.showWorkCompletion = showWorkCompletion;
        this.showAverageCompletionTime = showAverageCompletionTime;
        this.triggerCondition = triggerCondition;
        this.isArchive = isArchive;
        this.setOldTransferVersion(BasicConstant.ZERO);
        this.setUpdateTime(DateTimeUtil.getInt());
        this.setAddTime(DateTimeUtil.getInt());
        this.setDel(DelEnum.NORMAL.getDel());
    }
}